package com.zhejiangzhengyuan.municipal_common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * <p>
 * 权限模块中的认证主体表，与业务系统中的用户数据一一对应，存储用户的用户名、密码、权限关系起点。单独存储是为了将权限和业务解耦
 * </p>
 *
 * @author linju
 * @since 2019-11-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="Subject对象", description="权限模块中的认证主体表，与业务系统中的用户数据一一对应，存储用户的用户名、密码、权限关系起点。单独存储是为了将权限和业务解耦")
public class Subject extends Model<Subject> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增主键,唯一标识")
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "认证主体名称，常为用户名",required = true)
    @NotBlank(message = "常为用户名不能为空")
    private String subjectName;

    @ApiModelProperty(value = "认证主体密码",required = true)
    @NotBlank(message = "认证主体密码不能为空")
    private String password;

    @ApiModelProperty(value = "认证主体密码加密盐值")
    private String salt;

    @ApiModelProperty(value = "认证账户是否可用")
    private Boolean enabled;

    @ApiModelProperty(value = "记录创建时间")
    private Timestamp createTime;

    @ApiModelProperty(value = "记录更新时间")
    private Timestamp updateTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
